databaseChangeLog = {

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-1") {
		createTable(tableName: "app_user") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "version", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "account_expired", type: "BIT") {
				constraints(nullable: "false")
			}

			column(name: "account_locked", type: "BIT") {
				constraints(nullable: "false")
			}

			column(name: "enabled", type: "BIT") {
				constraints(nullable: "false")
			}

			column(name: "kindle_account", type: "VARCHAR(255)")

			column(name: "linked_with_facebook", type: "BIT") {
				constraints(nullable: "false")
			}

			column(name: "password", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}

			column(name: "password_expired", type: "BIT") {
				constraints(nullable: "false")
			}

			column(name: "time_zone", type: "VARCHAR(255)")

			column(name: "username", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-2") {
		createTable(tableName: "app_user_role") {
			column(name: "role_id", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "app_user_id", type: "BIGINT") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-3") {
		createTable(tableName: "facebook_user") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "version", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "access_token", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}

			column(name: "access_token_expires", type: "DATETIME")

			column(name: "uid", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "user_id", type: "BIGINT") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-4") {
		createTable(tableName: "feed") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "version", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "app_user_id", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "short_name", type: "VARCHAR(30)") {
				constraints(nullable: "false")
			}

			column(name: "url_id", type: "BIGINT") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-5") {
		createTable(tableName: "feed_entry") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "version", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "author", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}

			column(name: "description", type: "VARCHAR(2000)")

			column(name: "feed_url_id", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "link", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}

			column(name: "published_date", type: "DATETIME") {
				constraints(nullable: "false")
			}

			column(name: "receive_date", type: "DATETIME") {
				constraints(nullable: "false")
			}

			column(name: "title", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-6") {
		createTable(tableName: "feed_url") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "version", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "last_updated", type: "DATETIME") {
				constraints(nullable: "false")
			}

			column(name: "update_frequency", type: "INT") {
				constraints(nullable: "false")
			}

			column(name: "url", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-7") {
		createTable(tableName: "registration_code") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "date_created", type: "DATETIME") {
				constraints(nullable: "false")
			}

			column(name: "token", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}

			column(name: "username", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-8") {
		createTable(tableName: "role") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "version", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "authority", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-9") {
		createTable(tableName: "subscription") {
			column(autoIncrement: "true", name: "id", type: "BIGINT") {
				constraints(nullable: "false", primaryKey: "true")
			}

			column(name: "version", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "app_user_id", type: "BIGINT") {
				constraints(nullable: "false")
			}

			column(name: "enabled", type: "BIT") {
				constraints(nullable: "false")
			}

			column(name: "last_checked", type: "DATETIME")

			column(name: "prefix", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}

			column(name: "send_cron_expression", type: "VARCHAR(255)") {
				constraints(nullable: "false")
			}
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-10") {
		createTable(tableName: "subscription_feed") {
			column(name: "subscription_feeds_id", type: "BIGINT")

			column(name: "feed_id", type: "BIGINT")
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-11") {
		addPrimaryKey(columnNames: "role_id, app_user_id", tableName: "app_user_role")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-21") {
		createIndex(indexName: "username", tableName: "app_user", unique: "true") {
			column(name: "username")
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-22") {
		createIndex(indexName: "uid", tableName: "facebook_user", unique: "true") {
			column(name: "uid")
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-23") {
		createIndex(indexName: "authority", tableName: "role", unique: "true") {
			column(name: "authority")
		}
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-12") {
		addForeignKeyConstraint(baseColumnNames: "app_user_id", baseTableName: "app_user_role", baseTableSchemaName: "kindlerss_grails", constraintName: "FK9CE8F3CCEFF4E08C", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "app_user", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-13") {
		addForeignKeyConstraint(baseColumnNames: "role_id", baseTableName: "app_user_role", baseTableSchemaName: "kindlerss_grails", constraintName: "FK9CE8F3CCFE13A74B", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "role", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-14") {
		addForeignKeyConstraint(baseColumnNames: "user_id", baseTableName: "facebook_user", baseTableSchemaName: "kindlerss_grails", constraintName: "FK609FD5A43AAB70AA", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "app_user", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-15") {
		addForeignKeyConstraint(baseColumnNames: "app_user_id", baseTableName: "feed", baseTableSchemaName: "kindlerss_grails", constraintName: "FK2FE59EEFF4E08C", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "app_user", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-16") {
		addForeignKeyConstraint(baseColumnNames: "url_id", baseTableName: "feed", baseTableSchemaName: "kindlerss_grails", constraintName: "FK2FE59E6B5BDEB", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "feed_url", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-17") {
		addForeignKeyConstraint(baseColumnNames: "feed_url_id", baseTableName: "feed_entry", baseTableSchemaName: "kindlerss_grails", constraintName: "FK21E822916F33E7AC", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "feed_url", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-18") {
		addForeignKeyConstraint(baseColumnNames: "app_user_id", baseTableName: "subscription", baseTableSchemaName: "kindlerss_grails", constraintName: "FK1456591DEFF4E08C", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "app_user", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-19") {
		addForeignKeyConstraint(baseColumnNames: "feed_id", baseTableName: "subscription_feed", baseTableSchemaName: "kindlerss_grails", constraintName: "FK47A06F8071CFB64B", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "feed", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}

	changeSet(author: "sorin.buliarca (generated)", id: "1362572265898-20") {
		addForeignKeyConstraint(baseColumnNames: "subscription_feeds_id", baseTableName: "subscription_feed", baseTableSchemaName: "kindlerss_grails", constraintName: "FK47A06F807BBB7155", deferrable: "false", initiallyDeferred: "false", onDelete: "NO ACTION", onUpdate: "NO ACTION", referencedColumnNames: "id", referencedTableName: "subscription", referencedTableSchemaName: "kindlerss_grails", referencesUniqueColumn: "false")
	}
}
